From 70c9a612ce51a8352db878e240309c0b41b8a1ad Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Mon, 24 Feb 2014 06:26:49 -0800 Subject: [PATCH] Fix event race --- src/ChangeLog | 4 ++++ src/keyboard.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 82bdd127d26..e481a052abc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2014-02-24 Daniel Colascione + + * keyboard.c (read_char): Close race that resulted in lost events. + 2014-02-21 Daniel Colascione * dbusbind.c: Rename dbus-init-bus to dbus-init-bus-1. diff --git a/src/keyboard.c b/src/keyboard.c index 9dcb58ae66c..038ce6ea601 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2891,8 +2891,12 @@ read_char (int commandflag, Lisp_Object map, { c = read_decoded_event_from_main_queue (end_time, local_getcjmp, prev_event, used_mouse_menu); - if (end_time && timespec_cmp (*end_time, current_timespec ()) <= 0) - goto exit; + if (NILP(c) && end_time && + timespec_cmp (*end_time, current_timespec ()) <= 0) + { + goto exit; + } + if (EQ (c, make_number (-2))) { /* This is going to exit from read_char -- 2.30.2